import Vue from 'vue'

// 引用vuex
import Vuex from 'framework/vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		count: 0,
		tabCurrent: 0,
		tabList: [{
				iconPath: "/static/icon/purchaseList.png",
				selectedIconPath: "/static/icon/purcharseList_fill.png",
				text: '收购列表',
				//customIcon: true,
				pagePath: "/pages/purchase/purchase"
			},
			{
				iconPath: "/static/icon/sellList.png",
				selectedIconPath: "/static/icon/sellList_fill.png",
				text: '出售列表',
				//customIcon: true,
				pagePath: "/pages/sell/sell"
			},
			{
				iconPath: "/static/icon/workbench.png",
				selectedIconPath: "/static/icon/workbench_fill.png",
				text: '工作台',
				midButton: true,
				//customIcon: true,
				pagePath: "/pages/workbench/workbench"
			},
			{
				iconPath: "/static/icon/grain.png",
				selectedIconPath: "/static/icon/grain_fill.png",
				text: '项目管理',
				//customIcon: true,
				pagePath: "/pages/grain/grain"
			},
			{
				iconPath: "/static/icon/report.png",
				selectedIconPath: "/static/icon/report_fill.png",
				text: '报表管理',
				//customIcon: true,
				pagePath: "/pages/report/report"
			},
		],
		token:null
	},
	mutations: {
		increment(state) {
			state.count++;
		},
		changeTab(state,index){
			state.tabCurrent = index;
		},
		updateToken(state,token){
			console.log("token",token);
			state.token = token;
		}
	},
	getters: {
		getCount: state => {
			return state.count;
		},
		tabCurrent: state => {
			return state.tabCurrent;
		},
		tabList: state => {
			return state.tabList;
		},
		userToken:state =>{
			return state.token;
		}
	}
});

export default store;